package JAVASE512;

import java.util.Scanner;

public class JAVAlogical {
    public static void main(String[] argc){
        Scanner sc=new Scanner(System.in);
        //1.输入两个数
        int a = sc.nextInt();
        int b = sc.nextInt();
        //2.判断两个数：a为6或(a+b)%6==0
        boolean result = a == 6||b==6|| (a + b) % 6 == 0;
        System.out.println(result);
    }
}
